<?php
/**
 * Created by PhpStorm.
 * User: hehecat
 * Date: 2018/7/10
 * Time: 13:23
 */

namespace app\api\model;

use think\Db;

use think\Model;

class EnrollModel extends Model
{
    function enrolllist($userid) {
        $activity_result =  Db::table('activity_enroll')
            ->alias('enroll')
            ->join('activity',"enroll.activityid = activity.activityid and enroll.userid = '$userid' ")
            ->select();
        $course_result = Db::table('course_enroll')
            ->alias('enroll')
            ->join('course',"enroll.courseid = course.courseid and enroll.userid = '$userid' ")
            ->select();
        $game_result = Db::table('train_enroll')
            ->alias('enroll')
            ->join('train',"enroll.trainid = train.trainid and enroll.userid = '$userid' ")
            ->select();
        $train_result = Db::table('game_enroll')
            ->alias('enroll')
            ->join('game',"enroll.gameid = game.gameid and enroll.userid = '$userid' ")
            ->select();
        return ['followlist'=> ['activity'=>$activity_result, 'course'=>$course_result, 'game'=>$game_result,'train'=>$train_result]];
    }
}